package com.core.family.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;
import org.springframework.stereotype.Service;
import com.core.family.admin.domain.Navidata;
import com.core.family.admin.service.NavidataService;
import com.core.family.admin.domain.req.NavidataReq;
import com.core.common.gen.BaseQuery;
import com.core.common.gen.PageQuery;
import com.core.common.annotation.MenuDesc;
import com.core.common.domain.response.R;
import io.swagger.annotations.Api;
import org.springframework.beans.BeanUtils;


/**
* @author honglei
* @version 1.0
* @time: 2024-6-18 19:59:47
* @Description 服务实现层 导航数据
*/
@MenuDesc(desc = "导航数据", code = "ucNavidata")
@Api(tags = "NavidataController 导航数据")
@RestController
@RequestMapping("/api/ucNavidata/")
public class NavidataController {

    @Autowired
    NavidataService service;

    /**
    * 根据id获取详情
    * @param request
    * @param id
    * @return
    */
    @GetMapping(value = "get/{id}")
    public R get(HttpServletRequest request, @PathVariable("id") Long id){
        return R.ok(service.getById(id));
    }

    /**
    * 分页查询
    * @return
    */
    @RequestMapping(value = "getPage",method = {RequestMethod.GET,RequestMethod.POST})
    public R getPage(@RequestBody NavidataReq queryReq){
        return R.ok(service.selectPage(queryReq));
    }

    /**
    * 批量查询3
    * @return
    */
    @RequestMapping(value = "getList",method = {RequestMethod.GET,RequestMethod.POST})
    public R getList(@RequestBody NavidataReq queryReq){
        return R.ok(service.selectList(queryReq));
    }

    /**
    * 新增
    * @param bean
    * @return
    */
    @PostMapping(value = "create")
    public R create(@RequestBody Navidata bean){
        return R.ok(service.save(bean));
    }

    /**
    * 普通更新
    * @param bean
    * @return
    */
    @PostMapping(value = "edit")
    public R edit(@RequestBody Navidata bean){
        return R.ok(service.updateById(bean));
    }

    /**
    * 删除
    * @param request
    * @param id
    * @return
    */
    @PostMapping(value = "del/{id}")
    public R del(HttpServletRequest request, @PathVariable("id") Long id){
        return R.ok(service.removeById(id));
    }

    /**
    * 批量删除
    * @param request
    * @param ids
    * @return
    */
    @PostMapping(value = "delBatch")
    public R batchDel(HttpServletRequest request, @RequestBody List<String> ids ){
        return R.ok(service.removeByIds(ids));
    }


}
